package cn.wen233.srpc.core.spring.client;

import cn.wen233.srpc.core.utils.IocUtils;
import org.springframework.context.annotation.*;
import org.springframework.core.type.AnnotationMetadata;

/**
 * 自动配置类
 *
 * @author wenei
 * @date 2021-12-26 19:14
 */
@Configuration
@Import(InstanceAutoConfiguration.ReferenceProcessorImport.class)
public class InstanceAutoConfiguration {

    @Bean
    public IocUtils iocUtils() {
        return new IocUtils();
    }

    public static class ReferenceProcessorImport implements ImportSelector {

        private static final String PROCESS_CLASS = "cn.wen233.srpc.core.spring.client.ReferencePostProcessor";

        @Override
        public String[] selectImports(AnnotationMetadata annotationMetadata) {
            return new String[]{PROCESS_CLASS};
        }
    }
}
